<template>
  <div class="home">
    <a-row style="margin-top: 30px; text-align: center">
      <a-col>
        <a-button type="primary" @click="runSpider">运行爬虫</a-button>
        <a-button
          type="primary"
          danger
          @click="stopSpider"
          style="margin-left: 20px"
          >停止运行</a-button
        >
      </a-col>
    </a-row>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 'SipderView',
  methods: {
    async runSpider() {
      let res = await this.$http.get('/spider/start/')
      if (res.status == 200) {
        this.$msg.success(res.data)
      }
    },
    async stopSpider() {
      let res = await this.$http.get('/spider/stop/')
      if (res.status == 200) {
        this.$msg.info(res.data)
      }
    },
  },
}
</script>
<style lang="less" scoped>
</style>
